package com.woniuxy.gateway.exception;

import com.woniuxy.cloud.demo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 捕捉异常
 * 新增自定义异常请注释
 */
@RestControllerAdvice
@Slf4j
public class PawnExceptionHandler {

    @ExceptionHandler(Exception.class)
    public Result handlerException(Exception e) {
        log.error("出现异常", e);
        return new Result().setCode(500).setMsg(e.getMessage());
    }

}
